<?php

namespace App\Services\ReceiveProductOrder;

use App\Http\Controllers\Api\V1\Requests\FormRequest;
use Illuminate\Support\Facades\Redis;

class ReceiveProductOrderRequest extends FormRequest
{
	public function rules()
	{
		$this->verify();
		
		return [];
	}
	
	public function verify()
	{
		$order = $this->order;
		
		if(!Redis::hGet($order->cache_id,'is_paid')){

			fail('目标订单未支付');
		}

		if ($order->delivery_status == 'received') {
			fail('目标订单已收货');
		}
		
		return true;
	}
}
